<template>
  <div>
    {{this.userid}}
    <p>账号:<input type="text" v-model="from.username"></p>
    <p>密码:<input type="text" v-model="from.password"></p>
    <p>
      <button @click="login">登录</button>
    </p>
  </div>
</template>

<script>
export default {
  name: "day0404_login",
  data() {
    return {
      from:{},
      userid:localStorage.getItem('userid')
    }
  },
  methods: {
    login(){
      this.$axios.post('user/login/',this.from).then(res=>{
        localStorage.setItem('userid',res.data.userid)
      })
    }
  },
  mounted() {
    // localStorage.setItem('userid','')
  }

}
</script>

<style scoped>

</style>
